package cn.robot.upload.controller;

import cn.robot.upload.dto.UploadDto;
import cn.robot.upload.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version V3.0
 * @Title: UploadController
 * @Description: 描述
 * @author: Trident
 * @date 2020/10/3 上午9:53
 */
@RestController
public class UploadController {

    @Autowired
    private FileService fileService;

    @PostMapping("/upload")
    public String upload(@RequestBody UploadDto uploadDto) {
        try {
            fileService.upload(uploadDto.getName(), uploadDto.getMiner(), uploadDto.getToken());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
